/**
 * 资源预加载
 */

import common from '@/utils/common'

export default {
  namespaced: true,
  state () {
    return {

    }
  },
  mutations: {
    /**
     * 设置预加载资源
     */
    set (state) {

    }
  },
  actions: {
    /**
     * 完成预加载
     */
    complete (context, images) {
      return new Promise(resolve => {
        common.loadImages(images, (num, len, isComplete) => {
          if (isComplete) {
            resolve()
          }
        })
      })
    }
  }
}
